import sys; input = sys.stdin.readline; from array import * V, E = map(int, input().split()); M = [0]*V; R = {1<